home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / ultra250.zip / UW_HELP4.HLP < prev    next >
Text File  |  1992-11-03  |  27KB  |  636 lines

  1. `co(4,7);─────────────────────── /// Rectangle Functions ──────────────────────────────`co();
  2.  
  3.  ┌──────────────────────────────────────────────────────────────────────────┐    
  4.  │       `keyword(set_rect,/// set_rect);               `keyword(is_rect_equal,/// is_rect_equal);           `keyword(rect_overlap,/// rect_overlap);        │
  5.  │       `keyword(offset_rect,/// offset_rect);            `keyword(col_row_inrect,/// col_row_inrect);                              │
  6.  └──────────────────────────────────────────────────────────────────────────┘
  7.  
  8.         The UltraWin library uses the structure RECT to handle information
  9.     dealing with rectangular sections of the screen, as in the WINDOW
  10.     structure.    Included are functions to define the rectangle, check to see
  11.     if one rectangle overlaps another, and several other routines that you may
  12.     wish to utilize in your program.
  13.  
  14. `co(10,1);/// set_rect`co();   `keyword(source,[UW_WIN.C]~set_rect);
  15.         Takes the variable of type RECT passed by pointer, and sets the upper
  16.     left corner and lower right corner to the coordinates passed as integers.
  17.  
  18. Prototype:
  19.     void set_rect(RECT *rectp, int x1, int y1, int x2, int y2);
  20.  
  21. Parameters:
  22. `co(11,1);    RECT *rectp;`co();
  23.         A pointer to the rectangle variable.
  24. `co(11,1);    int x1, y1, x2, y2`co();
  25.         The coordinate pair for the upper left corner (x1,y1) and the lower
  26.         right corner (x2,y2) of the rectangle.
  27.  
  28. Usage:
  29.     RECT r;
  30.     ...
  31.     set_rect( &r, 10, 10, 20, 20 );
  32.  
  33. `co(10,1);/// is_rect_equal`co();   `keyword(source,[UW_WIN.C]~is_rect_equal);
  34.         Checks to see if the two rectangles are the same.
  35.  
  36. Prototype:
  37.     int is_rect_equal(RECT *r1, RECT *r2);
  38.  
  39. Parameters:
  40. `co(11,1);    RECT *r1, *r2;`co();
  41.         Pointers to the two rectangles to compare.
  42.  
  43. Usage:
  44.     RECT r1, r2;
  45.     ...
  46.     if (is_rect_equal( &r1, &r2 )) {}
  47.  
  48. `co(10,1);/// rect_overlap`co();   `keyword(source,[UW_WIN.C]~rect_overlap);
  49.         Reports on the relationship between two rectangles.  This function will
  50.     return the status as one of the following (defined in UW.H):
  51.  
  52.         1) FIRST_ENCLOSED
  53.                  The first rectangle is enclosed within the second.
  54.         2) SECOND_ENCLOSED
  55.                  The second rectangle is enclosed within the first.
  56.         3) OVERLAP
  57.                  The rectangles overlap.
  58.         4) NO_OVERLAP
  59.                  The rectangles do not overlap.
  60.  
  61. Prototype:
  62.     int rect_overlap(RECT *r1, RECT *r2);
  63.  
  64. Parameters:
  65. `co(11,1);    RECT *r1, *r2;`co();
  66.         The two rectangles whose relationship to find.
  67.  
  68. Usage:
  69.     RECT r1, r2;
  70.     int status;
  71.     ...
  72.     status = rect_overlap( &r1, &r2 );
  73.  
  74. `co(10,1);/// offset_rect`co();   `keyword(source,[UW_WIN.C]~offset_rect);
  75.         Moves the rectangles coordinates by a fixed positive or negative amount
  76.     in both the x (column) and y (row) direction.
  77.  
  78. Prototype:
  79.     void offset_rect(RECT *rectp, int col, int row);
  80.  
  81. Parameters:
  82. `co(11,1);    RECT *rectp;`co();
  83.         A pointer to the rectangle variable.
  84. `co(11,1);    int col, row`co();
  85.         The offsets to add to the rectangle's coordinates.
  86.  
  87. Usage:
  88.     RECT r;
  89.     ...
  90.     offset_rect( &r, 5, -4 );
  91.  
  92. `co(10,1);/// col_row_inrect`co();   `keyword(source,[UW_WIN.C]~cr_inrect);
  93.         Checks to see if a particular location is inside (or on the border of)
  94.     the rectangle passed.
  95.  
  96. Prototype:
  97.     int col_row_inrect(int col, int row, RECT *rectp);
  98.  
  99. Parameters:
  100. `co(11,1);    int col, row`co();
  101.         The coordinate to check.
  102. `co(11,1);    RECT *rectp;`co();
  103.         A pointer to the rectangle.
  104.  
  105. Usage:
  106.     RECT r;
  107.     ...
  108.     if (col_row_inrect( 5, 5, &r )) {}
  109.  
  110. `co(4,7);──────────────────────────── /// Data Entry ──────────────────────────────────`co();
  111.  
  112.  ┌──────────────────────────────────────────────────────────────────────────┐    
  113.  │           `keyword(wn_gets,/// wn_gets);                            `keyword(Masks/Templates,/// Masks/Templates);             │
  114.  │           `keyword(Validation Chars,/// Validation Chars);                   `keyword(Strip Mask Option,/// Strip Mask Option);           │
  115.  │           `keyword(wn_gets_ll,/// wn_gets_ll);                                                                     │
  116.  └──────────────────────────────────────────────────────────────────────────┘
  117.  
  118.       One of the most flexible of all functions in the UltraWin library is
  119.     wn_gets.  With this one function you can have the user enter dates, times,
  120.     prices, strings, and any other type with full control over every character
  121.     entered!  UltraWin versions 2.00 and up add an even more powerful lower
  122.     level function now called by wn_gets to enhance the capabilities even
  123.     further.  Full compatibility is maintained.  The new function called
  124.     wn_gets_ll has added the capability to uppercase the first character of
  125.     each word, strip the mask completely, only strip the end, or not strip at
  126.     all.  It can also get input right-to-left, clear an input on the first
  127.     non-keypad keypress, and exit when the last character in the input is
  128.     entered, saving an extra <Enter> keypress.  Furthermore it can allow the
  129.     user to input a string longer than the display width of the field and will
  130.     scroll within this region automatically!  It can also display arrows to
  131.     show the user that the string has data to the left or right of the current
  132.     display field.  If this isn't enough for you, we've added the ability to
  133.     call your own validation function for every character entered in
  134.     wn_gets_ll.  This allows you to validate the user's input "as it happens",
  135.     and enhance wn_gets_ll. A new wn_gets_ll hook added in version 2.10 allows
  136.     both pre and post processing, as well as the ability to modify the event
  137.     itself, giving you the ability to translate keys.
  138.     
  139.     See also `keyword(set_validation_func,/// set_validation_func);.
  140.  
  141. `co(10,1);/// wn_gets`co();   `keyword(source,[UW_ENTRY.C]~wn_gets);
  142.         Gets input from the user according to the restrictions of the mask and
  143.     template strings in the window passed by pointer.  This function will pass
  144.     back the input either with the mask characters included in the string, or
  145.     stripped out.    A -1 is returned if the mouse is clicked off of the string,
  146.     and one of the values KEY_UP, KEY_DN, KEY_PGUP, KEY_PGDN, KEY_ESC,
  147.     KEY_ENTER, KEY_TAB or KEY_SHFT_TAB (defined in UW_KEYS.H) is returned if
  148.     pressed.  Read about the mask and template strings for more information.
  149.  
  150. Prototype:
  151.     int wn_gets( char *str, char *mask, char *template, uchar m_att,
  152.                              int strip_mode, WINDOW *wnp );
  153.  
  154. Parameters:
  155. `co(11,1);    char *str`co();
  156.         The string to be returned by the function.
  157. `co(11,1);    char *mask`co();
  158.         The mask string.
  159. `co(11,1);    char *template`co();
  160.         The template string.
  161. `co(11,1);    uchar m_att`co();
  162.         The attribute (colors) to use when displaying the string.
  163. `co(11,1);    int strip_mode`co();
  164.         Set to 1 (STRIP_ON) to strip mask characters out of result, or set to 0
  165.         (STRIP_OFF) for full mask and result.
  166. `co(11,1);    WINDOW *wnp;`co();
  167.         A pointer to the window in which entry is to take place.
  168.  
  169. Usage:
  170.     WINDOW *wnp;
  171.     int result;
  172.     char s[80];
  173.     ...
  174.     result = wn_gets( s, "(___)-___-____", "###  ### ####",
  175.                                         wnp->att, STRIP_ON, wnp);
  176.  
  177. `co(10,1);/// Masks/Templates`co();
  178.  
  179.     The wn_gets function requires you to specify two important strings to
  180.     perform its magic.  These are the mask and template strings.
  181.  
  182.     The mask string gives you the flexibility of displaying textual
  183.     information inside the area to be typed by the user.    The mask characters
  184.     are displayed in each position of the string that does not have text.
  185.  
  186.     The template string is essentially a string containing validation
  187.     characters.  Before a character is entered into the string, the wn_gets
  188.     function compares the typed character with the template to see if the
  189.     character is valid.  In addition, the template can be used to force an
  190.     uppercase or lowercase character without having the user touch the
  191.     CapsLock or Shift keys.
  192.  
  193.     When combined, the mask and template strings give you great flexibility.
  194.     The following are just a few examples with explanations of what they
  195.     accomplish:
  196.  
  197.     mask = "________"           Enter an 8 character string, where all
  198.     tplt = "AAAAAAAA"           characters must be alphanumeric.
  199.     
  200.     mask = "________"           Enter an 8 character string, where
  201.     tplt = "********"           anything typed is valid.
  202.     
  203.     mask = "________"           Enter an 8 character string, where the
  204.     tplt = "Uaaaaaaa"           first character is converted to
  205.                                                             uppercase, and the rest must be alpha.
  206.     
  207.     mask = "________"           Enter an 8 character string, where all 8
  208.     tplt = "uuuuuuuu"           characters must be typed in uppercase.
  209.  
  210.     mask = "(___) ___-____"     Enter a 14 character string, where only
  211.     tplt = " ###  ### ####"     numbers can be typed at the _ positions.
  212.  
  213.  
  214. `co(10,1);/// Validation Chars`co();
  215.  
  216.     Validation characters are simply characters that are valid to put in your
  217.     templates.    The following is a list of the validation characters along
  218.     with their effect.
  219.     
  220.     Validation Char          Effect
  221.     ---------------          -----------------------------------------------
  222.              '#'             Allows only a digit to be entered.
  223.              '9'             Allows digits, '+', '-', '.', 'E', and 'e'.
  224.              'X'             Allows only a hexidecimal digit to be entered.
  225.              'u'             Allows only upper case letters to be entered.
  226.              'l'             Allows only lower case letters to be entered.
  227.              'U'             Converts to upper case, even if typed as lower.
  228.              'L'             Converts to lower case, even if typed as upper.
  229.              'A'             Allows only alphanumeric characters and <space>.
  230.              'a'             Allows only alpha characters and <space>.
  231.              'Y'             Allows only boolean Y/N.
  232.              'T'             Allows only boolean T/F.
  233.              'B'             Allows only boolean Y/N or T/F.
  234.              '*'             Allows any characters.
  235.  
  236. `co(10,1);/// Strip Mask Option`co();
  237.  
  238.     This parameter to the wn_gets function gives you the option to have
  239.     wn_gets either format the string with the mask characters intact, or strip
  240.     out the mask characters.    This can best be demonstrated as follows:
  241.  
  242.     mask = "(___) ___-____"
  243.     tplt = " ###  ### ####"
  244.     
  245.     When wn_gets is called with these parameters, and a phone number is
  246.     entered, the display looks like this:
  247.     
  248.                                                         (123) 456-7890
  249.  
  250.     Very simply, if the strip mask option is not used, then this string is
  251.     what is returned by the function (mask intact).     However, if the strip
  252.     mask option is used, then the returned string would be:
  253.     
  254.                                                              1234567890
  255.  
  256.     with no mask characters left, only what the user typed!  By utilizing this
  257.     parameter in appropriate places you can save yourself a considerable
  258.     amount of work.
  259.  
  260. `co(10,1);/// wn_gets_ll`co();   `keyword(source,[UW_ENTRY.C]~wn_gets_ll);
  261.         Has the same capabilities as wn_gets and more.  Wn_gets_ll has the
  262.     capability to uppercase the first char of each word, strip the mask
  263.     completely, only strip the end, or not strip at all.  Right-to-left input,
  264.     clear entry on first key, and auto-return is also supported.  The function
  265.     will also allow the user to input a string longer than the display width
  266.     of the field and will scroll within this region automatically.  It can
  267.     also display arrows to show the user that the string has data to the left
  268.     or right of the current display field.  We've added the ability to call
  269.     your own validation function for every character entered in wn_gets_ll.
  270.     This allows you to validate the user's input "as it happens", and
  271.     customize the validation routine.  See `keyword(set_validation_func,/// set_validation_func); for more
  272.     information.
  273.  
  274.         Starting with version 2.10 we've added a powerful hook into this
  275.     function that is called on entry, exit, and on every keypress.  It is
  276.     similar to the validation function except that wn_gets_ll expects a return
  277.     key value from the function, giving the hook the ability to translate
  278.     keystrokes.  See `keyword(set_gets_hook,/// set_gets_hook); for more details.
  279.   
  280.  
  281. Prototype:
  282.     int wn_gets_ll(    char *str, char *mask, char *template, uchar m_att,
  283.                                     int flags, int disp_width, WINDOW *wnp );
  284.  
  285. Parameters:
  286. `co(11,1);    char *str`co();
  287.         The string to be returned by the function.
  288. `co(11,1);    char *mask`co();
  289.         The mask string.
  290. `co(11,1);    char *template`co();
  291.         The template string.
  292. `co(11,1);    uchar m_att`co();
  293.         The attribute (colors) to use when displaying the string.
  294. `co(11,1);    int flags`co();
  295.    `co(15,1);G_STRIP`co();                strips the entire mask from the string.
  296.                         * 12/04/91 = 120491, (432)-555-3421 = 4325553421
  297.  
  298.    `co(15,1);G_STRIP_END`co();            strips the end of the string only.
  299.                           * John Doe____ = John Doe
  300.  
  301.    `co(15,1);G_UP_FST_CHAR`co();          convert the first letter of each word to uppercase,
  302.                            forcing all others to lowercase.
  303.                            * james elder II = James Elder Ii
  304.  
  305.    `co(15,1);G_UP_FST_CHAR2`co();          convert the first letter of each word to uppercase,
  306.                           leaving all others unchanged. 
  307.                           * james elder II = James Elder II
  308.  
  309.    `co(15,1);G_ARROW`co();                displays left and right arrows if display width is less
  310.                           than field width. NOTE: This requires an additional
  311.                           screen/window space before and after the field.
  312.  
  313.    `co(15,1);G_VALIDATE`co();             call the validation function set by `keyword(set_validation_func,/// set_validation_func); 
  314.  
  315.    `co(15,1);G_RIGHT_TO_LEFT`co();      gets input from the right side of the string.
  316.  
  317.    `co(15,1);G_CLEAR_ON_FIRST`co();     clears the entry string when the first valid non-keypad
  318.                                             key is pressed.
  319.  
  320.    `co(15,1);G_EXIT_ON_FILL`co();         returns when the last character in the entry is typed,
  321.                                              saving the user an <Enter> keypress.
  322.  
  323.    `co(15,1);G_MOVE_TO_END`co();           moves to the end of the field on entry.  This is the
  324.                                             equivalent of hitting <End>.
  325. `co(11,1);    int disp_width`co();
  326.         The number of characters to display.  If less than the length of the
  327.         input field, the display field will scroll.
  328. `co(11,1);    WINDOW *wnp;`co();
  329.         A pointer to the window in which entry is to take place.
  330.  
  331. Usage:
  332.     WINDOW *wnp;
  333.     int result;
  334.     char s[80];
  335.     ...
  336. /*---- strip mask, convert first character of each word to uppercase, -----*/
  337. /*------- and only display 6 characters, using arrows to show more --------*/
  338.     result = wn_gets_ll( s, "______________", "AAAAAAAAAAAAA", wnp->att,
  339.                                              G_STRIP | G_UP_FIRST_CHAR | G_ARROW, 6, wnp);
  340.  
  341. `co(10,1);/// set_validation_func`co();   `keyword(source,[UW_ENTRY.C]~set_validation_func);
  342.         Allows you to set your own data entry validation function that is
  343.     called every time a character is typed in `keyword(wn_gets_ll,/// wn_gets_ll);.  Note that this is
  344.     not necessarily called for every keystroke. If the user pressed the arrow
  345.     keys, backspace, etc. the function will not be called.  It is called only
  346.     when entering data.  (If you wish to process every keystroke, see
  347.   `keyword(set_gets_hook,/// set_gets_hook);.)  When the function is called it is passed a series of
  348.     parameters that allow complete flexibility.  The validation routine should
  349.     return a 1 if all's well, else it should return a 0.  If 0 is returned,
  350.     the entry routine will overwrite the invalid character with the mask
  351.     character for the current position.  See the demo program `keyword(str_demo,[STR_DEMO.C]main);
  352.     for more details.
  353.  
  354. Prototype:
  355.     void set_validation_func( int (*func_ptr)(char*, char*, char*,
  356.                                                         int, int, WINDOW*) );
  357.  
  358. Parameters:
  359. `co(11,1);    int (*func_ptr)(char*, char*, char*, int, int, WINDOW*)`co();
  360.         A function pointer which is called for each character entry.
  361.  
  362. Usage:
  363.     set_validation_func( date_vld );
  364.     ...
  365.     int date_vld( char *w, char *t, char *m, int pos, int max_pos,
  366.                                 WINDOW *wnp )
  367.     {
  368.         /* w       - pointer to current work string */
  369.         /* m       - pointer to the mask            */
  370.         /* t       - pointer to the template        */
  371.         /* pos     - current cursor position        */
  372.         /* max_pos - maximum cursor position        */
  373.         /* wnp     - pointer to the entry window (use for err msg, etc) */
  374.     }
  375.  
  376. `co(10,1);/// set_gets_hook`co();   `keyword(source,[UW_ENTRY.C]~set_gets_hook);
  377.         Allows you to set your own hook to be called from `keyword(wn_gets_ll,/// wn_gets_ll);.  Your
  378.     hook will be called on entry, exit, and every time a key is pressed.
  379.     Wn_gets_ll will call your function, passing the work string, template,
  380.     mask, cursor position, maximum cursor position, the process type,
  381.     a pointer to the global Event, and the window pointer for the entry.
  382.     
  383.       NOTE:  The process type can be one of the three defines ( in UW.H )
  384.     H_ENTRY, H_EXIT, or H_PROCESS.  Wn_gets_ll calls your hook on function
  385.     entry, exit, and every time a key is pressed.  You may modify any of the
  386.     strings passed, or even modify the key value.  If you wish to modify the
  387.     key, simply set event->key inside your routine.  This will allow you to
  388.     remap any of the keys used in the entry routine to ones you might like
  389.     more.
  390.     
  391.     
  392. Prototype:
  393.     void set_gets_hook( int (*func_ptr)(char*, char*, char*, int, int, int,
  394.                                             EVENT*, WINDOW*) );
  395.  
  396. Parameters:
  397. `co(11,1);    int (*func_ptr)(char*, char*, char*, int, int, int, EVENT*, WINDOW*)`co();
  398.       A pointer to the function to call.
  399.  
  400. Usage:
  401.     set_gets_hook( super_hook );
  402.     ...
  403.     int super_hook( char *w, char *t, char *m, int pos, int max_pos,
  404.                                     int proc_type, EVENT *event, WINDOW *wnp );
  405.     {
  406.         /* w               - pointer to current work string */
  407.         /* t               - pointer to the template        */
  408.         /* m               - pointer to the mask                         */
  409.         /* pos             - current cursor position        */
  410.         /* max_pos         - maximum cursor position        */
  411.         /* proc_type    - defines H_ENTRY, H_EXIT or H_PROCESS */
  412.         /* event            - pointer to the global Event variable */
  413.         /* wnp             - pointer to the entry window (use for err msg, etc) */
  414.     }
  415.  
  416. `co(4,7);───────────────────────────── /// Menuing ────────────────────────────────────`co();
  417.  
  418.  ┌──────────────────────────────────────────────────────────────────────────┐    
  419.  │          `keyword(menu_create,/// menu_create);             `keyword(menu_destroy,/// menu_destroy);          `keyword(menu_set,/// menu_set);          │ 
  420.  │          `keyword(menu_restore,/// menu_restore);            `keyword(item_add,/// item_add);              `keyword(do_menu,/// do_menu);           │
  421.  │          `keyword(menu_system,/// menu_system);                                                     │
  422.  └──────────────────────────────────────────────────────────────────────────┘
  423.  
  424.       UltraWin allows both vertical and horizontal menus to be easily created
  425.     and displayed for interaction with the user.    The menu's entries can be
  426.     selected with just one keystroke (or a simple click of the mouse).  The
  427.     letter to check when selecting an entry can be any character of the entry,
  428.     and can even be highlighted in a different color.  In addition, the menus
  429.     can be defined as POPUP, restoring the area under the menu when finished,
  430.     or they can be used with the window manager, forcing a redraw of
  431.     overlapping areas of any windows under the menu.
  432.  
  433. `co(10,1);/// menu_create`co();   `keyword(source,[UW_MENU.C]~menu_create);
  434.         Initializes the menu to the specified coordinates on the screen, the
  435.     menu attributes (colors), the border style and menu type passed.  A call
  436.     to this function must be made to define the menu before the menu is placed
  437.     on the screen with menu_set.    For the type parameter, use WN_POPUP if you
  438.     wish the menu to be a popup menu (restoring the screen below), or
  439.     WN_NORMAL if you are using UltraWin's powerful window manager.
  440.  
  441. Prototype:
  442.     void menu_create(int x_min, int y_min, int x_max, int y_max, int direction,
  443.                                      uchar back_att, uchar bdr_att, uchar csr_att,
  444.                                      uchar first_att, int bdr, int type, MENU *mnp);
  445.  
  446. Parameters:
  447. `co(11,1);    int x_min, y_min`co();
  448.         The upper left corner of the menu to create.
  449. `co(11,1);    int x_max, y_max`co();
  450.         The lower right corner of the menu to create.
  451. `co(11,1);    int direction`co();
  452.         The menu direction, use M_VERTICAL for a vertical menu and
  453.         M_HORIZONTAL for a horizontal menu.
  454. `co(11,1);    uchar back_att`co();
  455.         The attribute to use for the menu.    This defines the color of
  456.         the menu and the characters in the menu, and can be a value from
  457.         0-255.    For example, use (RED << 4) | WHITE for white menu entry
  458.         characters on a red background.
  459. `co(11,1);    uchar bdr_att`co();
  460.         The border attribute (not used if the bdr parameter is NO_BDR).
  461. `co(11,1);    uchar csr_att`co();
  462.         The attribute to use when displaying the cursor position.
  463. `co(11,1);    uchar first_att`co();
  464.         The attribute to use for the menu entry selection character.
  465.         Typically you would use the same background color as back_att,
  466.         but a different foreground color.
  467. `co(11,1);    int bdr`co();
  468.         The border style, can be either NO_BDR, SGL_BDR, DBL_BDR,
  469.         SLD_BDR or DUAL_BDR (defined in uw.h).
  470. `co(11,1);    int type`co();
  471.         The menu type, can be either WN_POPUP or WN_NORMAL.  Use the
  472.         former when not using the window manager.
  473. `co(11,1);    MENU *mnp;`co();
  474.         A pointer to the menu to create.
  475.  
  476. Usage:
  477.     MENU mn;
  478.     int back_att, bdr_att, csr_att, first_att;
  479.     ...
  480.     menu_create(0, 0, 20, 10, M_VERTICAL, back_att, bdr_att,
  481.                             csr_att, first_att, SGL_BDR, WN_NORMAL, *mn);
  482.  
  483. `co(10,1);/// menu_destroy`co();   `keyword(source,[UW_MENU.C]~menu_destroy);
  484.         Destroys the menu created with menu_create.  The window allocated for
  485.     the menu is freed.
  486.         
  487. Prototype:
  488.     void menu_destroy( MENU *mnp );
  489.  
  490. Parameters:
  491. `co(11,1);    MENU *mnp;`co();
  492.         A pointer to the menu to destroy.
  493.  
  494. Usage:
  495.     MENU *mnp;
  496.     ...
  497.     menu_destroy(mnp);
  498.  
  499. `co(10,1);/// menu_set`co();   `keyword(source,[UW_MENU.C]~menu_set);
  500.         Takes a menu created with menu_create, and places it on the screen.  If
  501.     the menu was defined with type WN_POPUP, the area below the window is
  502.     saved for later restoration.
  503.  
  504. Prototype:
  505.     void menu_set( MENU *mnp );
  506.  
  507. Parameters:
  508. `co(11,1);    MENU *mnp;`co();
  509.         A pointer to the menu to place on the screen.
  510.  
  511. Usage:
  512.     MENU *mnp;
  513.     ...
  514.     menu_set(mnp);
  515.  
  516. `co(10,1);/// menu_restore`co();   `keyword(source,[UW_MENU.C]~menu_restore);
  517.         Takes a menu created with menu_create and placed on the screen with
  518.     menu_set, and removes it from the screen.  If the menu was defined with
  519.     type WN_POPUP, the area below the window is restored.  If the menu was
  520.     defined with type WN_NORMAL and the window manager is in use, then the
  521.     area under the menu will be redrawn.
  522.  
  523. Prototype:
  524.     void menu_restore( MENU *mnp );
  525.  
  526. Parameters:
  527. `co(11,1);    MENU *mnp;`co();
  528.         A pointer to the menu to restore.
  529.  
  530. Usage:
  531.     MENU *mnp;
  532.     ...
  533.     menu_restore(mnp);
  534.  
  535. `co(10,1);/// item_add`co();   `keyword(source,[UW_MENU.C]~item_add);
  536.         Adds an entry into a menu.    An integer handle (or id) that you define is
  537.     passed to identify the entry. The menu_do function returns this id when
  538.     the entry is selected. In addition, the index into the string for the
  539.     "active" character is passed.    This is the character in the string that is
  540.     displayed in the first_att color upon display, and is used when a key on
  541.     the keyboard is pressed that matches.
  542.  
  543. Prototype:
  544.     void item_add( char *entry, int id, int first_pos, MENU *mnp );
  545.  
  546. Parameters:
  547. `co(11,1);    char *entry;`co();
  548.         The string to add to the menu.    This string does not have to be the same
  549.         length as the width of the menu, as the display routines of menu_set and
  550.         menu_do justify the entry for you.
  551. `co(11,1);    int id`co();
  552.         This is an id you define which will be returned to you when the menu
  553.         item is selected in menu_do.
  554. `co(11,1);    int first_pos`co();
  555.         This is an index into the string for the "active" letter.  This letter
  556.         will be used to check against keyboard letters pressed, and will be
  557.         displayed in the first_att color specified in the menu_create function.
  558.         For example, for the entry "Dos Shell" to make the menu_do function
  559.         return the id with one keypress, use a first_pos of 4, which corresponds
  560.         to the "S" in "Shell".
  561. `co(11,1);    MENU *mnp;`co();
  562.         A pointer to the menu to which the item is to be added.
  563.  
  564. Usage:
  565.     #define DOS_SHELL 37
  566.     MENU *mnp;
  567.     ...
  568.     item_add("Dos Shell", DOS_SHELL, 4, mnp);
  569.  
  570. `co(10,1);/// do_menu`co();   `keyword(source,[UW_MENU.C]~do_menu);
  571.         Activates a menu for input from the user.    Call this function after you
  572.     have called menu_set.  To retain flexibility, you may specify whether the
  573.     do_menu function should interact with the user through the wait_event
  574.     function, or immediately process the global Event variable and return to
  575.     you.    This gives you the ability to use your own event logic if you wish,
  576.     and is useful for menus which are static on the screen, as opposed to
  577.     menus that pop up and restore when finished.    If interaction through
  578.     wait_event is specified, then this function returns either the id of the
  579.     item selected, or 0 if no item is selected. If you have do_menu only
  580.     process the information in the global variable Event, then a 0 is returned
  581.     for each call to do_menu that does not have an [Enter] keypress in Event.
  582.  
  583. Prototype:
  584.     int do_menu( MENU *mnp, int proc_mode );
  585.  
  586. Parameters:
  587. `co(11,1);    MENU *mnp;`co();
  588.         A pointer to the menu for interaction.
  589. `co(11,1);    int proc_mode`co();
  590.         The processing mode, which can be one of the defines M_GET_EVENT or
  591.         M_PROC_EVENT.    If M_GET_EVENT is used, then the menu will get input via
  592.         the keyboard (or mouse if it exists) until the user has either selected
  593.         one of the items, or pressed the Esc key.
  594.  
  595. Usage:
  596.     MENU *mnp;
  597.     ...
  598.     do_menu( mnp, M_GET_EVENT );
  599.  
  600. `co(10,1);/// menu_system`co();   `keyword(source,[UW_MENU.C]~menu_system);
  601.         Was written specifically for the standard top menu bar with
  602.     corresponding drop down menus.  Menu_system gives you the option of
  603.     displaying the top menu upon entry and removing the top menu upon exit (a
  604.     popup menuing system), or simply use the top menu previously placed on the
  605.     screen with menu_set.  When called, the function will interact with the
  606.     user through the keyboard and mouse, and return the menu id of the entry
  607.     selected.  If the Esc key was pressed or the mouse clicked off the menu,
  608.     then a 0 is returned.  Upon completion, the global Event variable will
  609.     contain information about the last key or mouse press.
  610.  
  611.     NOTE: To utilize this function, you must first define your menus with
  612.     menu_create, then add each entry with item_add, being sure to define a
  613.     unique id for each entry.
  614.  
  615. Prototype:
  616.     int menu_system( MENU *top_mnp, MENU *dropmenu[], int draw_top );
  617.  
  618. Parameters:
  619. `co(11,1);    MENU *top_mnp;`co();
  620.         A pointer to the vertical main menu.
  621. `co(11,1);    MENU *dropmenu[];`co();
  622.         An array of pointers to a series of drop down menus.
  623. `co(11,1);    int draw_top`co();
  624.         This parameter can be either 1 or 0, and specifies whether the
  625.         menu_system function should handle the initial display of the top menu
  626.         or assume that the top menu is already displayed. Using a value of 1 is
  627.         useful if you wish your menu system to be hidden during your program,
  628.         and only called up with a key.    Use a 0 for when your program keeps the
  629.         top menu on the screen.
  630.  
  631. Usage:
  632.     MENU *top_mnp;
  633.     MENU *drop_mnp[8];
  634.     ...
  635.     menu_system( top_mnp, drop_mnp, 1);
  636.